package top.bug.blog.exception;

import top.bug.blog.enums.ErrorCode;

/**
 * @author <a href="https://github.com/jiusi66">九思.</a>
 * @email 10837907@qq.com
 * @from <a href="https://www.52bug.top">递归茶馆-www.52bug.top</a>
 * @description 自定义业务异常
 */
public class BussinessException extends RuntimeException {

    private ErrorCode code;

    public ErrorCode getCode() {
        return code;
    }

    public BussinessException(String message) {
        super(message);
        this.code = ErrorCode.FAIL;
    }

    public BussinessException(ErrorCode code) {
        super(code.getMessage());
        this.code = code;
    }

    public BussinessException(ErrorCode code, String message) {
        super(message);
        this.code = code;
    }
}